<%@page import="oa.service.impl.CompanyServiceImpl" %>
<%@page import="oa.service.CompanyService" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    request.setCharacterEncoding("UTF-8");
    response.setCharacterEncoding("UTF-8");
    response.setContentType("text/html;charset=utf-8");
    CompanyService company = new CompanyServiceImpl();
    int companyid = (int) session.getAttribute("companyid");
    if (companyid == 0) {
        session.setAttribute("companylist", company.selectAllCompany(0));
    } else {
        session.setAttribute("companylist", company.selectAllCompany(companyid));
    }

%>
<c:forEach var="companyitem" items="${companylist}">
    <tr>
        <td>${companyitem.companyName}</td>
        <td>${companyitem.companyUsername}</td>
        <td><fmt:formatDate type="both" value="${companyitem.companyTime}" pattern="yyyy-MM-dd"/></td>
        <td>

            <button type="button"
                    class="btn btn-info btn-sm btn-rounded m-b-2 m-l-5" id="select">
                <a href="${pageContext.request.contextPath}/selectcompany?companyid=${companyitem.companyId}&selectcompan=companyselect"
                   style="color: #DEE2E6">查看</a>
            </button>

            <button type="button"
                    class="btn btn-success btn-sm btn-rounded m-b-2 m-l-5" id="update">
                <a href="${pageContext.request.contextPath}/selectcompany?companyid=${companyitem.companyId}&selectcompan=companyup"
                   style="color: #DEE2E6">编辑</a>

            </button>

            <button type="button"
                    class="btn btn-danger btn-sm btn-rounded m-b-2 m-l-5 del " value="${companyitem.companyId}">删除
            </button>
            <input type="hidden" name="selectcompan" value="" id="selectcompan">
        </td>
    </tr>

</c:forEach>